<?php
namespace app\common\validate;
use think\Validate;
class Shop extends Validate
{
    protected $rule    = [
    	'shop_category_id' => 'require',
    	'title' => 'require|unique:shop,title',
    	'username' => 'require|unique:shop,username',
        'phone' => 'require|mobile|unique:shop,phone',

        'address' => 'require',
        'province'=>'require',
        'city'=>'require',
        'district'=>'require',
        'lat'=>'require|float',
        'lng'=>'require|float',
    ];
    protected $message = [
        'shop_category_id.require' => '请选择行业分类',
        'title.require' => '请选择店铺名称',
        'title.unique' => '该店铺名称已存在',
        'username.require' => '请输入用户名',
        'username.unique' => '该用户名已存在',
        'phone.require' => '手机号码不能为空',
        'phone.unique' => '该手机号已存在',
        'phone.mobile' => '手机号码格式错误',
    ];

    //验证场景
    protected $scene = [
        'reg' => ['phone'], #注册只需要电话
        'upaddress' => ['province','city','district','address','lat','lng'],
    ];


}
